package com.iqiyi.pps.epg.core.model.sginal;

import com.iqiyi.pps.epg.api.model.web.sginal.TSginalServer;
import org.hibernate.annotations.*;

import javax.persistence.*;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.sql.Timestamp;

/**
 * Created by zhang on 2017/5/31.
 */
@Entity
@Table(name = "sginal_server")
@org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.NONE)
public class SginalServer {

    public static final int IS_DELETE = 1;
    public static final int IS_NOT_DELETE = 0;

    public static final String[] SGINAL_TYPE_NAME = {"udp", "udi"};

    public static final int SERVER_TYPE_DEST = 4;
    public static final int SERVER_TYPE_MIDDLE = 3;
    public static final int SERVER_TYPE_AP = 2;

    private Integer id;
    private Integer fatherId;
    private String interfaceIp;
    private String port;
    private Integer inputType;
    private String inputIp;
    private Integer outputType;
    private String outputIp;
    private Integer sequence;
    private Integer serverType;
    private String ethNum;
    private Integer isDelete;
    private Timestamp addTime;
    private Timestamp updateTime;
    private Timestamp warnningTime;

    public TSginalServer convertThriftModel() {
        TSginalServer tSginalServer = new TSginalServer();
        tSginalServer.setId(this.id);
        tSginalServer.setFatherId(this.fatherId);
        tSginalServer.setInterfaceIp(this.interfaceIp);
        tSginalServer.setPort(this.port);
        tSginalServer.setInputType(this.inputType);
        tSginalServer.setInputIp(this.inputIp);
        tSginalServer.setOutputType(this.outputType);
        tSginalServer.setOutputIp(this.outputIp);
        tSginalServer.setSequence(this.sequence);
        tSginalServer.setServerType(this.serverType);
        tSginalServer.setEthNum(this.ethNum);
        tSginalServer.setAddTime(this.addTime.toString());
        tSginalServer.setUpdateTime(this.updateTime.toString());
        return tSginalServer;
    }

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    @Column(name="father_id")
    public Integer getFatherId() {
        return fatherId;
    }

    public void setFatherId(Integer fatherId) {
        this.fatherId = fatherId;
    }

    @Column(name="interface_ip")
    public String getInterfaceIp() {
        return interfaceIp;
    }

    public void setInterfaceIp(String interfaceIp) {
        this.interfaceIp = interfaceIp;
    }

    @Column(name="port")
    public String getPort() {
        return port;
    }

    public void setPort(String port) {
        this.port = port;
    }

    @Column(name="input_type")
    public Integer getInputType() {
        return inputType;
    }

    public void setInputType(Integer inputType) {
        this.inputType = inputType;
    }

    @Column(name="input_ip")
    public String getInputIp() {
        return inputIp;
    }

    public void setInputIp(String inputIp) {
        this.inputIp = inputIp;
    }

    @Column(name="output_type")
    public Integer getOutputType() {
        return outputType;
    }

    public void setOutputType(Integer outputType) {
        this.outputType = outputType;
    }

    @Column(name="output_ip")
    public String getOutputIp() {
        return outputIp;
    }

    public void setOutputIp(String outputIp) {
        this.outputIp = outputIp;
    }

    @Column(name="sequence")
    public Integer getSequence() {
        return sequence;
    }

    public void setSequence(Integer sequence) {
        this.sequence = sequence;
    }

    @Column(name="server_type")
    public Integer getServerType() {
        return serverType;
    }

    public void setServerType(Integer serverType) {
        this.serverType = serverType;
    }

    @Column(name="eth_num")
    public String getEthNum() {
        return ethNum;
    }

    public void setEthNum(String ethNum) {
        this.ethNum = ethNum;
    }

    @Column(name="is_delete")
    public Integer getIsDelete() {
        return isDelete;
    }

    public void setIsDelete(Integer isDelete) {
        this.isDelete = isDelete;
    }

    @Column(name="add_time")
    public Timestamp getAddTime() {
        return addTime;
    }

    public void setAddTime(Timestamp addTime) {
        this.addTime = addTime;
    }

    @Column(name="update_time", insertable = false, updatable = false)
    public Timestamp getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Timestamp updateTime) {
        this.updateTime = updateTime;
    }

    @Column(name="warnning_time")
    public Timestamp getWarnningTime() {
        return warnningTime;
    }

    public void setWarnningTime(Timestamp warnningTime) {
        this.warnningTime = warnningTime;
    }
}
